// part1:C14:ex14.9.cpp
// class Sales_data.
#include <iostream>
#include <fstream>
class Sales_data
{
    Sales_data();
    ~Sales_data(){}
    friend stream& operator>>(istream &is, Sales_data &item);
};

friend stream& operator>>(istream &is, Sales_data &item)
{
    double price;
    is >> item.bookNo >> item.units_sold >> price;

    if (is) 
    {
       item.revenue = item.units_sold >> price;
    }
    else 
    {
        item = Sales_data();
    }
    return is;
}
